const qhScrollMixin = {
	methods: {
		// scroll组件初始化的回调，获取父级高度并继承
		initScroll(elName, callback) {
			this.$nextTick(() => {
				setTimeout(() => {
					// #ifdef MP-ALIPAY
					const query = uni.createSelectorQuery();
					// #endif
					// #ifdef MP-WEIXIN
					const query = uni.createSelectorQuery().in(this);
					// #endif
					query.select(elName).boundingClientRect((rect) => {
						// console.log('rect', rect)
						typeof callback == "function" && callback(rect.height);
					}).exec();
				}, 100)
			})
		},
		// 下拉刷新的回调
		downCallback() {
			// mixin默认延时2000自动结束刷新
			setTimeout(() => {
				this.mescroll.endSuccess();
			}, 2000)
		},
		// 上拉加载的回调
		upCallback() {
			// mixin默认延时2000自动结束加载
			setTimeout(() => {
				this.mescroll.endErr();
			}, 2000)
		}
	}
}

export default qhScrollMixin;
